library(tidyverse)
library(kableExtra)
library(magrittr)
library(plotly)
library(sf)
This is a very basic static webpage you can make from an .Rmd file.
Math expressions, e.g. \(Y = X\beta + \epsilon\).
You can insert footnotes.1
Make links to important places like a Github Repository for this static webpage you are viewing.
There are excellent ways to display tabular data.
One of my favorite resources here.
| Sepal.Length | Sepal.Width | Petal.Length | Petal.Width | Species |
|---|---|---|---|---|
| 5.1 | 3.5 | 1.4 | 0.2 | setosa |
| 4.9 | 3.0 | 1.4 | 0.2 | setosa |
| 4.7 | 3.2 | 1.3 | 0.2 | setosa |
| 4.6 | 3.1 | 1.5 | 0.2 | setosa |
| 5.0 | 3.6 | 1.4 | 0.2 | setosa |
| 5.4 | 3.9 | 1.7 | 0.4 | setosa |
| 4.6 | 3.4 | 1.4 | 0.3 | setosa |
| 5.0 | 3.4 | 1.5 | 0.2 | setosa |
| 4.4 | 2.9 | 1.4 | 0.2 | setosa |
| 4.9 | 3.1 | 1.5 | 0.1 | setosa |
You can get very over-the-top with different ways to organize the data.
|
Maybe Too Many Groups
|
||||||
|---|---|---|---|---|---|---|
|
This Group
|
That Group
|
|||||
|
My Group
|
My Other Group
|
Another Group
|
||||
| mpg | cyl | disp | hp | drat | wt | |
| Mazda RX4 | 21.0 | 6 | 160 | 110 | 3.90 | 2.620 |
| Mazda RX4 Wag | 21.0 | 6 | 160 | 110 | 3.90 | 2.875 |
| Datsun 710 | 22.8 | 4 | 108 | 93 | 3.85 | 2.320 |
| Hornet 4 Drive | 21.4 | 6 | 258 | 110 | 3.08 | 3.215 |
| Hornet Sportabout | 18.7 | 8 | 360 | 175 | 3.15 | 3.440 |
R has amazing graphing powers—my favorite is the ggplot2 package—and a great community with people sharing their work—look up #TidyTuesday on Twitter—and teaching others how to do great work too. The plotly package let’s you make your plots interactive as well. Below are some examples from the Plotly reference guide, shown first as static images and then as interactive ones.
nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE)
nc_plot <- ggplot(data = nc) + geom_sf(aes(fill = AREA))
nc_plot
fig <- ggplotly(nc_plot)
fig
set.seed(8)
dat <- data.frame(cond = factor(rep(c("Treatment","Placebo"), each=200)), happiness = c(rnorm(200),rnorm(200, mean=.8)))
p <- ggplot(dat, aes(x=cond, y=happiness, fill=cond)) + geom_boxplot()
p
fig <- ggplotly(p)
fig
df <- diamonds[sample(1:nrow(diamonds), size = 1000),]
p <- ggplot(df, aes(x = color)) +
geom_bar(aes(y = ..count../sum(..count..), fill = cut)) +
scale_fill_brewer(palette = "Set3") +
ylab("Percent") +
ggtitle("Show precentages in bar chart") +
labs(x = "Color")
p
fig <- ggplotly(p)
fig
A very informative footnote here.↩︎